<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:sec="http://www.springframework.org/security/tags"
	xmlns:p="http://primefaces.org/ui">

	<h:form id="form_recipe_detail">
		<div class="row-fluid">
			<div class="span4">
				<p class="lead">
					#{C_RECIPE.recipe.name}
					<p:rating style="margin-top: -20px;"
						value="#{C_RECIPE.recipe.rating}" readonly="true" />
					<br />
				</p>
				<p>#{C_RECIPE.recipe.comment}</p>
			</div>
			<div class="span4">
				<p class="lead">Informations</p>
				<p>
					<h:outputText value="Inventé le " />
					<h:outputText value="#{C_RECIPE.recipe.created}">
						<f:convertDateTime timeStyle="long" />
					</h:outputText>
					<ui:fragment
						rendered="#{C_RECIPE.recipe.modified ne C_RECIPE.recipe.created}">
						<br />
						<h:outputText value=" puis Affiné le " />
						<h:outputText value="#{C_RECIPE.recipe.modified}">
							<f:convertDateTime timeStyle="long" />
						</h:outputText>
					</ui:fragment>
					<h:outputText value=" par #{C_RECIPE.recipe.author.nickName}" />
					<br />
					<h:outputText
						value="Rangé dans la collection #{C_RECIPE.recipe.collection.name}" />
				</p>
			</div>
			<div class="span4">
				<sec:authorize ifAnyGranted="ROLE_USER">
					<i class="icon-file"></i>
					<p:commandButton styleClass="btn btn-link juice-pureLink"
						value="Télécharger au format pdf" ajax="true">
						<f:ajax listener="#{C_RECIPE.export}" />
					</p:commandButton>
					<br />
					<i class="icon-pencil"></i>
					<p:commandButton styleClass="btn btn-link juice-pureLink"
						action="#{C_RECIPE.edit}" value="Editer" ajax="false"
						disabled="#{! C_RECIPE.owner}" />
					<br />
					<i class="icon-trash"></i>
					<p:commandButton styleClass="btn btn-link juice-pureLink"
						action="#{C_RECIPE.delete}" value="Supprimer" ajax="false"
						disabled="#{! C_RECIPE.owner}" />
				</sec:authorize>
			</div>
		</div>
		<div class="row-fluid">
			<div class="span4">
				<p class="lead">Bases</p>
				<ul class="unstyled">
					<ui:repeat var="ub" value="#{C_RECIPE.recipe.useBases}">
						<li>#{ub.base.comment} #{ub.base.name} #{ub.concentration} -
							#{ub.quantity} #{ub.unit}</li>
					</ui:repeat>
				</ul>
			</div>
			<div class="span4">
				<p class="lead">Aromes</p>
				<ul class="unstyled">
					<ui:repeat var="ua" value="#{C_RECIPE.recipe.useAromas}">
						<li>#{ua.aroma.name} - #{ua.quantity} #{ua.unit}</li>
					</ui:repeat>
				</ul>
			</div>
			<div class="span4">
				<p class="lead">Additifs</p>
				<ul class="unstyled">
					<ui:repeat var="ud" value="#{C_RECIPE.recipe.useAdditives}">
						<li>#{ud.additive.name} - #{ud.quantity} #{ud.unit}</li>
					</ui:repeat>
				</ul>
			</div>
		</div>

	</h:form>

</ui:composition>
